package com.keepsport.keepsportapi.controller;

import com.keepsport.keepsportapi.config.SystemConfig;
import com.keepsport.keepsportapi.service.intf.UserActivityService;
import com.keepsport.keepsportapi.vo.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

@RestController
@Api(tags = "活动报名")
@RequestMapping("/api/useractivity/")
@CrossOrigin
public class UserActivityController {
    @Resource
    private UserActivityService service;
    @ApiOperation(value = "报名活动")
    @GetMapping("add.do")
    public R add(int aid, HttpServletRequest request){
        return service.save(aid,request.getIntHeader(SystemConfig.TOKEN_HEADER));
    }
    @ApiOperation(value = "查看我的活动")
    @GetMapping("all.do")
    public R all(HttpServletRequest request){
        return service.queryByUid(request.getIntHeader(SystemConfig.TOKEN_HEADER));
    }
}

